<extend name="Public/base" />

<block name="body">
    <div class="main-title" style="padding-bottom: 10px;" >
        <h2>扬州鲜生活电子报损清单</h2>
    </div>
    <div class="row" ng-controller="RejectCtrl">
        <form action="{:U('add')}" method='post' class="form-horizontal" ng-init='init({$product})'>
                <div class="panel panel-primary">
                    <div class="panel-heading" style="padding-bottom: 5px;padding-top: 5px;">
                        <span class="check-tips"><button type="button" id="add_new" class='btn btn-primary' ng-click="moreItem()">添加新商品</button></span>
                    </div>
                    <div class="panel-body" style="padding-bottom: 0px;padding-top: 0px;">
                        <div class="form-item cf">
                            <div class="controls">
                                <div style="border: #000 1px solid;margin-top: 5px;margin-bottom: 5px;" class='data-table table-striped '>
                                    <table  id="tbodyspec">
                                        <thead>
                                        <tr>
                                            <th scope="col" width="20%">商品名称（规格）</th>
                                            <th scope="col">报损数量</th>
                                            <th scope="col">报损原因</th>
                                            <th scope="col">操作</th>
                                        </tr>
                                        </thead>
                                        <tbody id="tbodyspec_a">
                                        <tr ng-repeat="item in items">
                                            <td class="change">
                                                <select select2 style="height: 30px; width:307px;" name="pname[]" ng-change="select($index,x)" ng-model="x">
                                                    <option value="">请选择...</option>
                                                    <option ng-repeat="p in product" value="{{p.pname}}" >{{p.pname}}</option>
                                                </select>
                                            </td>
                                            <td>
                                                <input class="input-3x" type="text" ng-model="item.cnt" ng-change="cnt($index)" name="cnt[]" required/>
                                            </td>
                                            <td>
                                                <textarea name="reason[]" ></textarea>
                                            </td>
                                            <td><button type="button" class="btn btn-info" ng-click="removeItem($index)"> - </button></td>
                                        </tr>
                                        <!--读取商品信息-->
                                        <tr id="tflag"></tr>
                                        </tbody>
                                    </table>

                                </div>
                                <label for="buyer" style="float: right;color: red;font-size: 16px;">
                                    确认人：
                                    <select name="buyer" id="buyer" class="search-input" style="height: 30px;width:90px">
                                        <volist name="cwlist" id="vo">
                                            <option value="{$vo.uid},{$vo.nickname}">{$vo.nickname}</option>
                                        </volist>
                                    </select>
                                </label>
                            </div>
                        </div>
                    </div>
                </div>
            <div class="col-md-12 " >
                <button type="submit" class="btn confirm btn-danger" style="">保 存</button>
                <a  class="btn btn-success" id="fh" onclick="javascript:history.back(-1); return false;">返 回</a>
            </div>
        </form>
    </div>
</block>

<block name="script">
    <script type="text/javascript">
        highlight_subnav('{:U('Loss/index')}');
    </script>
</block>
